﻿using ALMDDD.Domain.Core.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text;

namespace ALMDDD.Domain.Model
{
    /// <summary>
    /// 用户领域实体
    /// </summary>
    [Table("sys_user")]
    public class Sys_User : Entity
    {
        public Sys_User()
        { }

        public Sys_User(Guid id, string userId, string userName, string gender, string pwd, string email, string phone, DateTime trxTime, List<Sys_Role> sys_Role)
        {
            if (string.IsNullOrEmpty(userId))
            {
                throw new ArgumentException("id不能为空");
            }
            if (string.IsNullOrWhiteSpace(userId))
            {
                throw new ArgumentException("用户id不能为空");
            }
            Id = id;
            UserName = userName;
            UserId = userId;
            Gender = gender;
            PassWord = pwd;
            Email = email;
            Phone = phone;
            TrxTime = trxTime;
            Sys_Role = sys_Role;
        }

        [NotMapped]
        public List<Sys_Role> Sys_Role
        {
            get;
            private set;
        }
        /// <summary>
        /// 用户id
        /// </summary>
        public string UserId { get; private set; }
        /// <summary>
        /// 用户名
        /// </summary>
        public string UserName { get; private set; }
        /// <summary>
        /// 性别
        /// </summary>
        public string Gender { get; private set; }
        /// <summary>
        /// 密码
        /// </summary>
        public string PassWord { get; private set; }
        /// <summary>
        /// 邮箱
        /// </summary>
        public string Email { get; private set; }
        /// <summary>
        /// 手机号
        /// </summary>
        public string Phone { get; private set; }

    }
}
